package com.yanqu.road.server.cmd.activity.dafuweng;

import com.yanqu.road.entity.activity.dafuweng.DFWConfig;
import com.yanqu.road.pb.monopoly.MonopolyProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.dafuweng.DaFuWengMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_DA_FU_WENG_SKIP_BOSS_EVENT_FROM_CROSS, desc = "跨服调过boss事件")
public class DaFuWengSkipBossEventFromCrossCmd extends AbstractCommand {

    int activityId;
    int bossId;
    boolean canSkip;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        MonopolyProto.CrossSkipBossEventRespMsg reqMsg = MonopolyProto.CrossSkipBossEventRespMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        bossId = reqMsg.getBossId();
        canSkip = reqMsg.getCanSkip();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        DFWConfig config = DaFuWengMgr.getDfwConfig();
        if (config != null && config.getActivityInfo().getActivityId() == activityId
                && ActivityMgr.activityInTime(config.getActivityInfo())) {
            DaFuWengMgr.crossBossSkipEvent(player, activityId, bossId, canSkip);
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
